#pragma once

#include "ServerNetwork.h"
#include "..\..\nclgl\NetworkData.h"
#include "TerrainGenerationData.h"
#include "PlayerDataNetworking.h"
#include "PlayerInformationNetworking.h"

#define MAX_NUM_PLAYERS_PER_SESSION 4

class ServerGame {

public:

	ServerGame(void);
	~ServerGame(void);

	void update();
	void receiveFromClients();
	void sendActionPackets(PacketTypes TYPE);

	void sendInitialDataToClients();
	void sendUpdateDataToClient(unsigned int idClient);


private:

	// IDs for the clients connecting for table in ServerNetwork 
	static unsigned int client_id;
	// The ServerNetwork object 
	ServerNetwork* network;
	// data buffer
	char network_data[MAX_PACKET_SIZE];

	int numPlayersConnected;

	TerrainGenerationData* terrainData;

	PlayerInformationNetworking* pINet;
	PlayerDataNetworking* DecodePlayerData(const Packet* packet);
	Packet* EncodePlayerInformation(const PlayerInformationNetworking* pInfoNw);
};